package com.t11;

import org.omg.CORBA.CODESET_INCOMPATIBLE;

import java.util.*;

/**
 * Created by xuyiwei on 2018/7/22.
 */
public class AddingGroups {
    public static void main(String[] args) {
        Collection<Integer> collection = new ArrayList<>(Arrays.asList(1,2,3,4,5));
        Integer[] moreInts = {6,7,8,9,10};
        //list添加数组
        collection.addAll(Arrays.asList(moreInts));
        //list添加数组
        Collections.addAll(collection,moreInts);
        //list添加可变参数
        Collections.addAll(collection,1,2,3,4,5);
        //如果list是由数组转换而来的  底层还是数组  数组长度不可变的   因此list.add(21)会报错
        List<Integer> list = Arrays.asList(16,17,18,19,20);
        list.set(1,99);
        System.out.println(Arrays.toString(list.toArray()));
        //因此会报错
        list.add(21);
    }
}
